package com.example.demo.entity;

import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import java.time.LocalDateTime;

/**
 * 账户实体类，用于数据库存储
 */
@Data
@Entity
@Table(name = "account")
@NoArgsConstructor
public class AccountEntity {
    
    @Id
    @Column(length = 50)
    private String address;
    
    @Column(name = "public_key", length = 160)
    private String publicKey;
    
    @Column(name = "private_key", length = 160)
    private String privateKey;
    
    @Column(name = "create_time")
    private LocalDateTime createTime;
    
    @Column(name = "is_default")
    private Boolean isDefault = false;
    
    /**
     * 创建账户实体
     */
    public AccountEntity(String address, String publicKey, String privateKey) {
        this.address = address;
        this.publicKey = publicKey;
        this.privateKey = privateKey;
        this.createTime = LocalDateTime.now();
    }
} 